<template>
  <el-col :span="24">
    <div class="record" style="border-radius: 15px; ">
      <h1>今日门诊记录</h1>
      <el-table ref="singleTable" :data="Managementarr" style="width: 100%">
        <el-table-column type="index" label="序号" width="100" style="width: 100%; "></el-table-column>
        <el-table-column label="就诊状态" width="120">
          <template slot-scope="scope">
            <span style="color:#b1eed8;">{{scope.row.state}}</span>
          </template>
        </el-table-column>
        <el-table-column property="num" label="患者编号" width="120"></el-table-column>
        <el-table-column property="name" label="患者姓名" width="80"></el-table-column>
        <el-table-column label="性别" width="80">
          <template slot-scope="scope">{{typeObj[scope.row.sex]}}</template>
        </el-table-column>
        <el-table-column property="age" label="年龄" width="80"></el-table-column>
        <el-table-column property="phone" label="手机号码" width="120"></el-table-column>
        <el-table-column label="门诊类型" width="80">
          <template slot-scope="scope">{{type1[scope.row.type]}}</template>
        </el-table-column>
        <el-table-column label="科室" width="80">
          <template slot-scope="scope">{{type2[scope.row.office]}}</template>
        </el-table-column>
        <el-table-column property="doctor" label="挂号医生" width="80"></el-table-column>
        <el-table-column property="date" label="最后更新时间"></el-table-column>
      </el-table>

      <!-- 分页 -->

      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page.sync="currentPage"
        background
        :page-size="pageSize"
        layout="prev, pager, next, jumper"
        :total="total"
      ></el-pagination>
    </div>
  </el-col>
</template>

<script>
export default {
  props: ["Managementarr", "total", "pageSize"],
  data() {
    return {
      typeObj: {
        0: "男",
        1: "女"
      },
      type1: {
        2: "急诊",
        3: "初诊"
      },
      type2: {
        4: "全科",
        5: "外科",
        6: "内科",
        7: "耳鼻喉科",
        8: "口腔科"
      },

      currentRow: null,
      currentPage: 1
    };
  },

  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.$parent.pageSize = val;
      this.$parent.getDate();
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.$parent.page = val;
      this.$parent.getDate();
    }
  }
};
</script>

<style lang='less' scope>
.el-pagination {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.record {
  background-color: #fff;
  border-radius: 10px;
  padding: 20px;
  h1 {
    margin-bottom: 20px;
    font-size: 18px;
    color: #4b4b4b;
  }
  .has-gutter {
    font-size: 14px;
    color: #525252;
  }
  .el-table__row {
    font-size: 14px;
    color: #a3a3a3;
    box-shadow: 0px 0px 6px #e9ebfc;
  }

  .el-pagination.is-background .el-pager li:not(.disabled).active {
    background: #979def;
    color: #e7e8fb;
    border: none;
  }
  .el-pagination.is-background .btn-next,
  .el-pagination.is-background .btn-prev,
  .el-pagination.is-background .el-pager li {
    background-color: #fff;
    border: 2px solid #525252;
    border-radius: 50%;
  }
  .el-pagination__editor.el-input .el-input__inner {
    border: 2px solid #525252;
    border-radius: 50%;
  }
  .el-pagination__editor.el-input {
    width: 36px;
  }
  .el-table td.el-table__cell,
  .el-table th.el-table__cell.is-leaf {
    border-bottom: none;
  }
}
.el-col-24 {
  min-width: 1180px;
}
</style>